<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Easy
  </div>
  <div>
   <h1 class="question_title">
    258. Add Digits
   </h1>
   <p>
    Given a non-negative integer
    <code>
     num
    </code>
    , repeatedly add all its digits until the result has only one digit.
   </p>
   <p>
    <strong>
     Example:
    </strong>
   </p>
   <pre>
<strong>Input:</strong> <code>38</code>
<strong>Output:</strong> 2 
<strong>Explanation: </strong>The process is like: <code>3 + 8 = 11</code>, <code>1 + 1 = 2</code>. 
&nbsp;            Since <code>2</code> has only one digit, return it.
</pre>
   <p>
    <b>
     Follow up:
    </b>
    <br>
    Could you do it without any loop/recursion in O(1) runtime?
   </p>
  </div>
  <div>
   <h1 class="question_title">
    258. 各位相加
   </h1>
   <p>
    给定一个非负整数
    <code>
     num
    </code>
    ，反复将各个位上的数字相加，直到结果为一位数。
   </p>
   <p>
    <strong>
     示例:
    </strong>
   </p>
   <pre><strong>输入:</strong> <code>38</code>
<strong>输出:</strong> 2 
<strong>解释: </strong>各位相加的过程为<strong>：</strong><code>3 + 8 = 11</code>, <code>1 + 1 = 2</code>。 由于&nbsp;<code>2</code> 是一位数，所以返回 2。
</pre>
   <p>
    <strong>
     进阶:
    </strong>
    <br>
    你可以不使用循环或者递归，且在 O(1) 时间复杂度内解决这个问题吗？
   </p>
  </div>
 </body>
</html>